home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / Python 1.4 source / Mac / Tools / twit / twit.py < prev    next >
Encoding:
Python Source  |  1996-10-23  |  1.2 KB  |  53 lines  |  [TEXT/Pyth]

  1. """twit - The Window-Independent Tracer.
  2.  
  3. Interface:
  4. twit.main()                        Enter debugger in inactive interactive state
  5. twit.run(stmt, globals, locals)    Enter debugger and start running stmt
  6. twit.post_mortem(traceback)        Enter debugger in post-mortem mode on traceback
  7. twit.pm()                        Enter debugger in pm-mode on sys.last_traceback
  8.  
  9. main program: nothing but a bit of glue to put it all together.
  10.  
  11. Jack Jansen, CWI, August 1996."""
  12.  
  13. import os
  14. if os.name == 'mac':
  15.     import MacOS
  16.     MacOS.splash(515)    # Try to show the splash screen
  17.     import mactwit_app; twit_app = mactwit_app
  18. else:
  19.     try:
  20.         import _tkinter
  21.         have_tk = 1
  22.     except ImportError:
  23.         have_tk = 0
  24.     if have_tk:
  25.         import tktwit_app; twit_app = tktwit_app
  26.     else:
  27.         print 'Please implementent machine-dependent code and try again:-)'
  28.         sys.exit(1)
  29.     
  30. import sys
  31.     
  32. def main():
  33.     twit_app.Initialize()
  34.     if os.name == 'mac':
  35.         MacOS.splash()
  36.     twit_app.Twit('none', None)
  37.     
  38. def run(statement, globals=None, locals=None):
  39.     twit_app.Initialize()
  40.     twit_app.Twit('run', (statement, globals, locals))
  41.  
  42. def post_mortem(t):
  43.     Initialize()
  44.     twit_app.Twit('pm', t)
  45.     
  46. def pm():
  47.     post_mortem(sys.last_traceback)
  48.     
  49. if __name__ == '__main__':
  50.     main()
  51.     
  52.     
  53.